Add request filter for early user and query parsing#748
Conversation
5c57364 to
28caef2
Compare
|
Addressed the review comments. |
239f66a to
68e1860
Compare
|
How about using a single filter to parse all the data instead of having multiple filters? |
|
I would like to keep it separate as they are different and will be parsed at different priorities (user info might need to be parsed at pre-authentication and query might be parsed at pre-authorization), The query information may not be present for all the requests. |
b97df7f to
b202da0
Compare
|
Added a new |
|
@ebyhr - I have addressed the review comments. |
910492f to
1d71ebd
Compare
1d71ebd to
48a3b6f
Compare
|
@vishalya are you still working on this? Would love to see it land -- this is a great cleanup |
|
I’ll spend some time on the code comments this week |
48a3b6f to
e20aff9
Compare
Chaho12
left a comment
There was a problem hiding this comment.
LGTM. Can you resolve comments if they are addressed :)
9ea3587 to
bf4cdbf
Compare
bf4cdbf to
a75b9fe
Compare
|
Let's get this merged. This refactoring would affect others quite a bit. |
| public PathFilter( | ||
| List<String> statementPaths, | ||
| List<String> extraWhitelistPaths) |
There was a problem hiding this comment.
Please inject HaGatewayConfiguration instead.
| List<String> statementPaths, | ||
| List<String> extraWhitelistPaths) | ||
| { | ||
| this.statementPaths = Set.copyOf(requireNonNull(statementPaths, "Required configuration 'statementPaths' can't be null")); |
There was a problem hiding this comment.
Use ImmutableSet.copyOf and remove requireNonNull.
| this("", "", "", ImmutableList.of(), Optional.empty(), Optional.empty(), | ||
| ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of(), false, Optional.empty()); |
There was a problem hiding this comment.
The convention is single line or separate lines.
this(
"",
"",
"",
ImmutableList.of(),
Optional.empty(),
Optional.empty(),
ImmutableSet.of(),
ImmutableSet.of(),
ImmutableSet.of(),
false,
Optional.empty());| private Optional<String> extractUserFromCookies(ContainerRequestContext requestContext, String userField) | ||
| { | ||
| if (request.getCookies() == null) { | ||
| Map<String, jakarta.ws.rs.core.Cookie> cookies = requestContext.getCookies(); |
| private static final int MAX_QUERY_TEXT_LOG_LENGTH = 100; | ||
| private final boolean isAnalyzeRequest; |
There was a problem hiding this comment.
Add an empty line between constants and fields.
| try { | ||
| when(uriInfo.getRequestUri()).thenReturn(new URI("http://localhost" + HttpUtils.OAUTH_PATH)); | ||
| } | ||
| catch (URISyntaxException e) { | ||
| throw new RuntimeException(e); | ||
| } |
| try { | ||
| when(uriInfo.getRequestUri()).thenReturn(new URI("http://localhost" + HttpUtils.V1_STATEMENT_PATH)); | ||
| } | ||
| catch (URISyntaxException e) { | ||
| throw new RuntimeException(e); | ||
| } |
| try { | ||
| when(uriInfo.getRequestUri()).thenReturn(new URI("http://localhost" + HttpUtils.V1_STATEMENT_PATH)); | ||
| } | ||
| catch (URISyntaxException e) { | ||
| throw new RuntimeException(e); | ||
| } |
| try { | ||
| when(uriInfo.getRequestUri()).thenReturn(new URI("http://localhost" + HttpUtils.V1_STATEMENT_PATH)); | ||
| } | ||
| catch (URISyntaxException e) { | ||
| throw new RuntimeException(e); | ||
| } |
|
|
||
| final class TestQueryUserInfoParser | ||
| { | ||
| private QueryUserInfoParser filter; |
Description
The parsing of the user and query was happening at different places and at a later stages, this PR structures it to happen at a early stage and a single point in time.
Additional context and related issues
Release notes
(X) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required, with the following suggested text: